package com.gh.pattern.observer.douyu;

import com.gh.pattern.observer.core.Event;

import java.lang.reflect.Method;

public class ObserverTest {
    public static void main(String[] args) {
        Watcher watcher = new Watcher();
        try {
            Method onSing = Watcher.class.getMethod("onSing", Event.class);
            Method onDance = Watcher.class.getMethod("onDance", Event.class);


            Zhubo zhubo = new Zhubo();
            zhubo.addLisenter(Zhubozaigansm.ON_SING,watcher,onSing);
            zhubo.addLisenter(Zhubozaigansm.ON_DANCE,watcher,onDance);
            zhubo.sing();
            zhubo.dance();


        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
